
from selenium.webdriver.common.by import By
from pages.base_page import BasePage

class HomePage(BasePage):
    """定义home页面"""
    url_ = "http://192.168.1.48/crm4/v0.5.5/index.php?m=dynamic&a=index"
    to_client_locator = (By.LINK_TEXT,"客户")
    knowledge_locator = (By.CSS_SELECTOR,"body > div.navbar.navbar-inverse.navbar-fixed-top > div > div > div.nav-collapse.collapse > ul:nth-child(1) > li.dropdown.open > ul > li:nth-child(2) > a")

    sj_locator = (By.LINK_TEXT, '商机')
    contract_locator = (By.LINK_TEXT, '合同')
    more_locator = (By.LINK_TEXT, '更多')
    mark_locator = (By.LINK_TEXT, '营销')


    def to_client(self):
        self.findE(self.to_client_locator).click()

    def choose_agenda(self):
        self.findE(self.knowledge_locator).click()




    def get_current_url(self):
        return self.driver.current_url

    def enter_sj(self):
        self.find_element(self.sj_locator).click()

    def enter_contract(self):
        self.find_element(self.contract_locator).click()

    def more(self):
        """点击更多"""
        self.find_element(self.more_locator).click()

    def point_mark(self):
        """点击营销"""
        self.find_element(self.mark_locator).click()

